package com.sino.extension;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;
/**
 * 在bean初始化之后调用
 * 
 * AOP实现源代码解析：https://blog.csdn.net/cplasf_/article/details/108694947
 * BeanPostProcessor AOP实现是 AbstractAdvisorAutoProxyCreator 
 * @author amd
 *
 */
@Component
public class DemoBeanPostProcessor implements BeanPostProcessor {
	private static final Logger log = LogManager.getLogger();
	
    public Object postProcessBeforeInitialization(Object bean, String beanName) {
    	log.info(">>>>>>>>>>>>>> 前postProcessBeforeInitialization：{}   {}",bean,beanName); 
        return bean; 
    }

    public Object postProcessAfterInitialization(Object bean, String beanName) {
        
        log.info(">>>>>>>>>>>>>> 后postProcessAfterInitialization：{}   {}",bean,beanName);
        return bean;
    }
}